package com.example.pro1.util.zhao;

import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.io.InputStream;

public class FileRead {

    //getResourceAsStream方法获取数据流
    //jar 包中没有实际路径
    public InputStream getFileInputSting1(String filename)
    {
        return this.getClass().getClassLoader().getResourceAsStream(filename);
    }

    //getResourceAsStream方法获取数据流
    //直接获取resources文件
    //jar 包中没有实际路径
    public InputStream getFileInputSting2(String filename)
    {
        return this.getClass().getResourceAsStream("/public/"+filename);
    }

    //不懂
    public static InputStream getFileInputSting6(String filename) throws IOException {

        return  new ClassPathResource(filename).getInputStream();
    }

}
